package org.kth.dks;

import java.io.IOException;

import org.kth.dks.dks_exceptions.DKSIdentifierAlreadyTaken;
import org.kth.dks.dks_exceptions.DKSRefNoResponse;
import org.kth.dks.dks_exceptions.DKSTooManyRestartJoins;

import business.search_eng.PostingList;

public class JDHTReputated extends JDHT{
	// if peer is bad reputation goes downnnn i.e. neg values,
	// thus if peer is considered like a reference reputations goess uppppp i.e pos values
	public double reputation = 0.0;
	
	public JDHTReputated(int port, String url, double reputation) throws IOException,
			DKSTooManyRestartJoins, DKSIdentifierAlreadyTaken, DKSRefNoResponse {
		super(port, url);
		this.reputation=reputation;
	}
	
	public JDHTReputated(int port, double reputation) throws IOException,
			DKSTooManyRestartJoins, DKSIdentifierAlreadyTaken, DKSRefNoResponse {
		super(port);
		this.reputation=reputation;
	}
	
	public Object put(Object key, PostingList pl) {
		// TODO Auto-generated method stub
		pl.scores.put("reputation", this.reputation);
		return super.put(key, pl);
	}
	
	


}
